package com.mingqijia.gassafety.webserver.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mingqijia.gassafety.db.entity.ServiceCombo;
import com.mingqijia.gassafety.db.mapper.ServiceComboMapper;
import com.mingqijia.gassafety.webserver.service.ServiceComboService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class ServiceComboServiceImpl extends ServiceImpl<ServiceComboMapper, ServiceCombo> implements ServiceComboService {


    @Override
    public Boolean addCombo(List<ServiceCombo> comboList) {
        boolean saveBatch = this.saveBatch(comboList);
        return saveBatch;
    }

    @Override
    public List<ServiceCombo> queryByBillCode(List<String> billCodes) {
        QueryWrapper<ServiceCombo> dtuQueryWrapper = new QueryWrapper<>();
        dtuQueryWrapper.lambda().in(ServiceCombo::getBillCode, billCodes)
                .eq(ServiceCombo::getIsDeleted, 0);
        List<ServiceCombo> serviceCombos = this.list(dtuQueryWrapper);
        return serviceCombos;
    }

    @Override
    public Boolean updateCombo(List<ServiceCombo> comboList) {
        return this.saveOrUpdateBatch(comboList);
    }
}
